package main

import (
	"fmt"
)

func subsets(nums []int) [][]int {

	result := [][]int{{}}
	for _, num := range nums {
		tmp := [][]int{}
		for _, item := range result {
			tmpV := make([]int, len(item))
			copy(tmpV, item)
			tmpV = append(tmpV, num)
			tmp = append(tmp, tmpV)
		}
		result = append(result, tmp...)
	}
	return result
}

func mainTest() {
	nums := []int{1, 2, 3}
	result := subsets(nums)
	fmt.Println(result)
}
